package ooday04;

public class Test {
    public static void main(String[] args) {
       /* Master math=new Master();
        Dog dog=new Dog("小黑",2,"黑");
        Fish fish=new Fish("小金",2,"金");
        Chick chick=new Chick("小黄",2,"黄");
        math.feed(dog);
        math.feed(fish);
        math.feed(chick);*/

        Animal[] animals=new Animal[5];
        animals[0]=new Dog("小黑",2,"黑");
        animals[1]=new Dog("小白",2,"白");
        animals[2]=new Fish("小金",2,"金");
        animals[3]=new Chick("小灰",2,"灰");
        animals[4]=new Chick("小黄",2,"黄");
        for (int i = 0; i < animals.length; i++) {
            System.out.println(animals[i].name);
            animals[i].eat();
            if (animals[i] instanceof Dog){
                Dog dog=(Dog) animals[i];
                dog.lookHouse();
            }
            if (animals[i] instanceof Chick){
                Chick chick=(Chick) animals[i];
                chick.cji();
            }
            if (animals[i] instanceof Fish){
                Fish fish=(Fish) animals[i];
                fish.swim();
            }

            //math.feed(animals[i]);
        }
    }

}
